Kanzi 4.0.0-beta2
kanzi::platform Namespace Reference

Classes

class  AndroidPlatform
 
class  EmscriptenPlatform
 
struct  GLFunctionPointers
 
class  OpenGLPlatform
 The OpenGL platform interface that is used by the OpenGL backend to interact with the platform. More...
 
class  Platform
 Kanzi platform interface definition. More...
 
class  QnxPlatform
 QNX Platform class. More...
 
class  StubPlatform
 Stub Platform class. More...
 
struct  SurfaceBits
 Describes the bit representation of a surface buffer. More...
 
struct  SurfaceProperties
 Describes the properties of a surface. More...
 
class  WaylandPlatform
 
class  Win32Platform
 
class  X11Platform
 

Typedefs

template<typename T_Return = void, typename... T_Args>
using function_ptr
 
using NativeSurfaceHandle
 Information necessary for native surfaces such as windows.
 

Enumerations

enum class  ColorSpace : uint8_t {
  sRGB , DisplayP3 , BT2020 , HDR10 ,
  Count
}
 Defines the color space options for an image or frame buffer. More...
 
enum class  MultisampleCount : uint8_t {
  NoMSAA , MSAAx2 , MSAAx4 , MSAAx8 ,
  MSAAx16 , MSAAx32
}
 Defines the available numbers of samples for multisample anti-aliasing (MSAA). More...
 
enum class  PlatformFeatureId { sRGBSurface , Count }
 Defines the platform features that can be present or missing on a specific platform. More...
 
enum class  PresentMode : uint8_t { Immediate , FIFO , FIFORelaxed , Mailbox }
 Defines the options for surface present mode. More...
 
enum class  SwapBehavior : uint8_t { Preserved , Destroyed , Unspecified }
 Defines the options for surface swap behavior. More...
 

Functions

shared_ptr< OpenGLPlatformcreateDefaultOpenGLPlatform (OpenGLPlatform::InitializationInfo &&info)
 Creates the default OpenGL platform implementation for the current platform.
 
void createDefaultPlatform (const SystemConfiguration &configuration)
 Creates default Platform instance singleton.
 
void destroyDefaultPlatform ()
 Destroys default Platform instance singleton.
 
KZ_NO_DISCARD SharedLockedPtr< PlatformgetDefaultPlatform ()
 Queries default Platform instance singleton.
 
template<typename Loader >
auto loadGlFunction (platform::OpenGLPlatform &platform)
 Acquires a GL function pointer.
 
MultisampleCount toMultisampleCount (size_t sampleCount)
 Gets kanzi graphics multi sample count from an integral sample count.
 
string toString (PlatformFeatureId feature)
 Converts a PlatformFeatureId to a string.
 

Typedef Documentation

◆ function_ptr

template<typename T_Return = void, typename... T_Args>
using kanzi::platform::function_ptr

◆ NativeSurfaceHandle

Information necessary for native surfaces such as windows.

The underlying objects are platform specific, such as HWND on Windows, ANativeWindow* on Android, xcb_window_t on X11, wl_surface* on Wayland and so on.

Since
Kanzi 4.0.0

Enumeration Type Documentation

◆ MultisampleCount

Defines the available numbers of samples for multisample anti-aliasing (MSAA).

Since
Kanzi 4.0.0
Enumerator
NoMSAA 

Single sample. Disables MSAA.

MSAAx2 

MSAA with 2 samples.

MSAAx4 

MSAA with 4 samples.

MSAAx8 

MSAA with 8 samples.

MSAAx16 

MSAA with 16 samples.

MSAAx32 

MSAA with 32 samples.

◆ ColorSpace

Defines the color space options for an image or frame buffer.

Since
Kanzi 4.0.0
Enumerator
sRGB 

sRGB-encoded color (IEC 61966-2-1:1999).

DisplayP3 

P3-D65-encoded color.

BT2020 

BT.2020-encoded color.

HDR10 

HDR10-encoded color.

Count 

Number of ColorSpace options.

◆ SwapBehavior

Defines the options for surface swap behavior.

Since
Kanzi 4.0.0
Enumerator
Preserved 

Preserves the surface contents when swapped.

Destroyed 

Destroys the surface contents when swapped.

Unspecified 

Does not specify the surface contents when swapped.

◆ PresentMode

Defines the options for surface present mode.

Since
Kanzi 4.0.0
Enumerator
Immediate 

Swaps at any time. Tearing can occur.

FIFO 

Queues and swaps buffers in the order given during the VBLANK interval.

FIFORelaxed 

Behaves otherwise like FIFO, but if no image is available, the next image is Immediate.

This option prefers tearing over showing a stale image.

Mailbox 

Similar to FIFO, but only a single surface is in the queue.

If the second surface is prepared before the next VBLANK, replaces the surface.

◆ PlatformFeatureId

Defines the platform features that can be present or missing on a specific platform.

Since
Kanzi 4.0.0
Enumerator
sRGBSurface 

Whether an sRGB-encoded surface frame buffer is available.

Count 

Number of FeatureId options.

Function Documentation

◆ loadGlFunction()

template<typename Loader >
auto kanzi::platform::loadGlFunction ( platform::OpenGLPlatform & platform)

Acquires a GL function pointer.

If GL function is defined, returns a pointer to it. If GL function is not defined, acquires the pointer by using platform-specific xxxGetProcAddress().

Template Parameters
LoaderGL function loader generated by KANZI_GENERATE_GL_LOADER().
Parameters
platformPlatform to use.
Returns
Proxy function pointer that can be used as a requested GL function pointer.
Since
Kanzi 4.0.0

◆ toString()

string kanzi::platform::toString ( PlatformFeatureId feature)
inline

Converts a PlatformFeatureId to a string.

Parameters
featureThe platform feature id.
Returns
A string representation of the feature id.
Since
Kanzi 4.0.0

◆ toMultisampleCount()

MultisampleCount kanzi::platform::toMultisampleCount ( size_t sampleCount)
inline

Gets kanzi graphics multi sample count from an integral sample count.

Parameters
sampleCountThe integral sample count.
Returns
The kanzi graphics multi sample count.
Since
Kanzi 4.0.0

◆ createDefaultPlatform()

void kanzi::platform::createDefaultPlatform ( const SystemConfiguration & configuration)

Creates default Platform instance singleton.

This function is thread-safe. This function blocks until all pointers returned from getDefaultPlatform() have been destructed.

Parameters
configurationSystem configuration.
Since
Kanzi 4.0.0

◆ destroyDefaultPlatform()

void kanzi::platform::destroyDefaultPlatform ( )

Destroys default Platform instance singleton.

This function is thread-safe. This function blocks until all pointers returned from getDefaultPlatform() have been destructed.

Since
Kanzi 4.0.0

◆ getDefaultPlatform()

KZ_NO_DISCARD SharedLockedPtr< Platform > kanzi::platform::getDefaultPlatform ( )

Queries default Platform instance singleton.

This function is thread-safe. This function blocks while createDefaultPlatform() or destroyDefaultPlatform() is executing.

See also
createDefaultPlatform()
Returns
Shared locked pointer to the platform instance, or a null pointer if the platform instance has not been created. The platform instance singleton is guaranteed to be neither created nor destroyed while the return value exists.
Since
Kanzi 4.0.0